package com.wanlian.File;

import com.wanlian.util.ListUtil;

import java.util.ArrayList;
import java.util.List;

public class FileContinueRecord {
    private boolean hasRead;
    private List<NetFileInfo> needContinueFileInfos;


    public FileContinueRecord(){
        this.hasRead=false;
        this.needContinueFileInfos=new ArrayList<>();
    }

    public boolean isHasRead() {
        return hasRead;
    }

    public void setHasRead(boolean hasRead) {
        this.hasRead = hasRead;
    }

    public List<NetFileInfo> getNeedContinueFileInfos() {
        return needContinueFileInfos;
    }

    public void setNeedContinueFileInfos(List<NetFileInfo> needContinueFileInfos) {
        this.needContinueFileInfos = needContinueFileInfos;
    }

    public synchronized List<NetFileInfo> deQueue(int count){
        ListUtil<NetFileInfo> netFileInfoListUtil = new ListUtil(this.getNeedContinueFileInfos());
        List<NetFileInfo> tags = netFileInfoListUtil.deQueue(count);
        if(count>=this.needContinueFileInfos.size()){
            this.hasRead=true;
        }
        return tags;
    }


}
